﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Threading;
using AbstraX.Contracts;

namespace CodeGenerationPipeline.Contracts
{
    public delegate void WatchProcess(IGenerator generator, Process process, bool blockUntilFinished, int timeout);

    public interface IGenerator
    {
        ICodeGenerationPackage GenerateFrom(Dictionary<string, IElementBuild> builds, DirectoryInfo workspaceDirectory);
        ICodeGenerationPackage GenerateFromPackage(ICodeGenerationPackage incomingPackage);
        PipelineTemplateEngineHost TemplateEngineHost { set; }
        IDomainHostApplication DomainHostApplication { set; }
        IPipelineStep PipelineStep { set; }
        string SDKFolder { set; }
        string DotNetFxFolder { set; }
        event WatchProcess OnWatchProcess;
        void OnError(int errorCode, Exception exception, string error);
        void OnProcessExited(int exitCode);
        void OnProcessTimeout();
        void OnOutput(string output);
        void OnFileCreated(FileInfo file);
        void OnFileChanged(FileInfo file);
        void OnFileRenamed(FileInfo file, FileInfo oldFile);
        void OnFileDeleted(FileInfo file);
        string Name { get; }
        string Description { get; }
        string WorkspaceDirectory { get; }
        Dictionary<string, FileInfo> Files { get; }
    }
}
